<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>可以转角的文字</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <section>
    <div class="skew1">
      <h2 class="layer">Corner Text</h2>
    </div>
    <div class="text_box">
      <div class="skew2">
        <h2 class="layer">Corner Text</h2>
      </div>
    </div>
  </section>
</body>
<script>
  document.addEventListener('mousemove', (e) => {
    document.querySelectorAll('.layer').forEach(layer => {
      let x = (window.innerWidth - e.pageX * 2) / 2
      layer.style.transform = `translateX(${x}px)`
    })
  })
</script>

</html>